﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Nirvana
{
    /// <summary>
    /// 变量重引用基类，用于Editor自定义面板属性下，检测对应属性变量是否修改
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable]
    public class BaseVariate<T>: Variate
    {
        [SerializeField]
        private bool hasValue;
        [SerializeField]
        private T value;
        public BaseVariate() { }
        public BaseVariate(T t,bool hasValue)
        {
            this.value = t;
            this.hasValue = hasValue;
        }

        public T GetValue()
        {
            return this.value;
        }
        public void SetValue(T t)
        {
            this.value = t;
            this.hasValue = true;
        }

        public bool IsHasValue()
        {
            return this.hasValue;
        }

        public void Clear()
        {
            this.hasValue = false;
        }
    }
}

